// components/menus/menus.js
Component({
    properties: {
        menuList: { type: Array, value: [] },
        selectMenu: { type: Object, value: 1 },
        type: { type: String, value: '1' }
    },
    data: {
        isShow: false,
        itemid: ''
    },
    methods: {
        changeMenu(e) {
            this.setData({ itemid: 'item' + (e.currentTarget.dataset.index - 1) });
            wx.pageScrollTo({
                selector: '#item' + (e.currentTarget.dataset.index - 1)
            });

            // 将科目名称和赋分标识一起作为唯一标识符
            this.setData({
                selectMenu: e.currentTarget.dataset.value,
                isShow: false
            });

            // 触发父组件的事件
            this.triggerEvent("changeMenu", e.currentTarget.dataset.value);
        },
        displayMenu() {
            this.setData({ isShow: true });
        },
        closeMenu() {
            this.setData({ isShow: false });
        }
    }
});
